<?php
	$fields_arr = array(
		'title'=>'标题',
		'key'=>'key',
		'summary'=>'描述',
		'width'=>'规格(px)',
		'cate'=>'类型',
		'default_type'=>'默认显示',
		'default_content'=>'默认显示的内容',
		'status'=>'状态',
		'manager_name'=>'操作人',
		'operation'=>'操作',
	);
	if(!$custom_field_arr){
		$custom_field_arr = array_flip($fields_arr);
	}
	$fields_arr_new = array_merge($custom_field_arr,array_flip($fields_arr));
	$fields_arr_new = array_unique($fields_arr_new);
?>
{include app:admin.inc.header}
<!--tmpl-resource-->
{include app:admin.inc.top}
<link rel="stylesheet" href="/res/js/framework/nestable/nestable.css">
<div class="container-fluid content-body">
	<div class="main">
		<!-- left side start-->

		<section class="left-section">
			<dl id="leftNav" data-type="message">
				<dt><i class="glyphicon glyphicon-plus"></i> 信息管理</dt>
				{if in_case_array('admin/notice',$priv) || empty($priv)}
				<dd><a class="mbh" href="{url /admin/notice/index}">公告管理</a></dd>
				{/if}
				{if in_case_array('admin/information',$priv) || empty($priv)}
				<dd><a class="mbh" href="{url /admin/information/index}">资讯管理</a></dd>
				{/if}
				{if in_case_array('admin/singlepage',$priv) || empty($priv)}
				<dd><a class="mbh" href="{url /admin/singlepage/index}">单页管理</a></dd>
				{/if}
				{if in_case_array('admin/brand',$priv) || empty($priv)}
				<dd><a class="mbh" href="{url /admin/brand/index}">特约品牌</a></dd>
				{/if}
				{if in_case_array('admin/adPlace',$priv) || empty($priv)}
				<dd><a class="mb active" href="{url /admin/adPlace/index}">广告位管理</a></dd>
				{/if}
				{if in_case_array('admin/ad',$priv) || empty($priv)}
				<dd><a class="mbh" href="{url /admin/ad/index}">广告管理</a></dd>
				{/if}
			</dl>
		</section>

		<!-- left side end-->


		<!-- main content start-->
		<section class="right-section" id="right-section">
			{include admin.inc.bread}
			<h2 class="header">广告位列表</h2>
			<!-- start of inner-frame -->
			<div class="inner-iframe">

				<div class="inner-container">
					<form class="form-inline search-form" role="form">
						<nav class="inline-form clearfix">
							<!--<a class="btnlg mb" href="{$add_url}"><i class="css-add"></i>添加广告位</a>-->
							<div class="r">
								<div class="form-group">
									<div class="input-group">
										<div class="input-group-addon">
											标题
										</div>
										<input type="text" class="form-control input-sm" maxlength="50" placeholder="标题" name="s_title" value="{$s_title}">
									</div>
								</div>
								<div class="form-group">
									<div class="input-group">
										<div class="input-group-addon">
											描述
										</div>
										<input type="text" class="form-control input-sm" maxlength="255" placeholder="描述" name="s_summary" value="{$s_summary}">
									</div>
								</div>
								<div class="form-group">
									<div class="input-group">
										<div class="input-group-addon">
											类型
										</div>
										<div class="css-select">
											<div class="chosen">
												<span></span>
												<i class="angle-down"></i>
												<input type="hidden" name="s_cate" value="{$s_cate}">
											</div>
											<ul>
												<li data-value="">全部</li>
												<li data-value="0">图片</li>
											</ul>
										</div>
									</div>
								</div>
								<div class="form-group">
									<div class="input-group">
										<div class="input-group-addon">
											默认显示
										</div>
										<div class="css-select">
											<div class="chosen">
												<span></span>
												<i class="angle-down"></i>
												<input type="hidden" name="s_default_type" value="{$s_default_type}">
											</div>
											<ul>
												<li data-value="">全部</li>
												<li data-value="0">图片</li>
											</ul>
										</div>
									</div>
								</div>
								<div class="form-group">
									<div class="input-group">
										<div class="input-group-addon">
											默认显示的内容
										</div>
										<input type="text" class="form-control input-sm" maxlength="255" placeholder="默认显示的内容" name="s_default_content" value="{$s_default_content}">
									</div>
								</div>
								<div class="form-group">
									<div class="input-group">
										<div class="input-group-addon">
											状态
										</div>
										<div class="css-select">
											<div class="chosen">
												<span></span>
												<i class="angle-down"></i>
												<input type="hidden" name="s_status" value="{$s_status}">
											</div>
											<ul>
												<li data-value="">全部</li>
												<li data-value="0">禁用</li>
												<li data-value="1">启用</li>
											</ul>
										</div>
									</div>
								</div>

								<input type="hidden" name="order" value="{$order}">
								<button type="submit" class="btnlg mb">搜索</button>
								<input type="hidden" name="pagesize" value="{$pagesize}" >
								<button type="button" class="btnlg mb" id="defined">配置列表项</button>
							</div>
						</nav>

					</form>
					<form id="J_List_Form">
						<div class="table-responsive">
							<table id="J_ListTable" class="table  table-hover  table-striped">
								<thead>
									<tr>
										<th width="20">
											<label class="css-checkbox">
												<input type="checkbox" class="check-all">
												<span></span>
											</label>
										</th>
										{loop $custom_field_arr $k $v}
										<th>{$fields_arr[$v]}</th>
										{/loop}
									</tr>
								</thead>
								<tbody>
								{if empty($items)}
								<tr>
									<td style="text-align:center;" colspan="9" class="empty-table-td">{$emptyRecord}</td>
								</tr>
								{/if}
								{loop $items $value}
								<tr>
									<td>
										<label class="css-checkbox">
											<input type="checkbox"  name="ids[]" value="{$value[id]}">
											<span></span>
										</label>
									</td>
									{loop $custom_field_arr $v}
									{if $v=='width'}
									<td>{$value[width]}x{$value[height]}</td>
									{else}
									{if $v=='cate'}
									<td>{if $value[cate] == 1}图片{else}图片{/if}</td>
									{else}
									{if $v=='default_type'}
									<td>{if $value[default_type] == 1}图片{else}图片{/if}</td>
									{else}
									{if $v=='status'}
									<td>{if $value[status] == 1}启用{else}禁用{/if}</td>
									{else}
									{if $v=='operation'}
									<td>
										{if in_case_array('admin/adplace/edit',$priv) || empty($priv)}
										<a href="{$edit_url}?id={$value[id]}" class="btnsm-primary">编辑</a>
										{/if}
										{if in_case_array('admin/adplace/add',$priv) || empty($priv)}
										<a href="{url admin/ad/add}?ad_place_key={$value[key]}" class="btnsm-primary"><i class="glyphicon glyphicon-plus"></i> 添加广告</a>
										{/if}
										<a href="{url admin/ad/index}?s_ad_place_key={$value[key]}" class="btnsm-primary">查看广告</a>
									</td>
									{else}
									<td>{$value[$v]}</td>
									{/if}
									{/if}
									{/if}
									{/if}
									{/if}
									{/loop}
								</tr>
								{/loop}
							</table>
						</div>
					</form>
					<div class="text-right">
						{$pagemenu}
					</div>
				</div>
			</div>
		</section>
	</div>
</div>
{include admin.inc.footer}
<!--自定义start-->
<script id="defined_table" type="text/html">
	<div>
		<form id="defined_edit" class="form-horizontal">
			<input type="hidden" name="url" value="{$module}/{$action}/{$method}">
			<div class="de_title"><i></i>拖动改变顺序</div>
			<div class="cf">
				<div class="dd" id="nestable3">
					<ol class="dd-list">
						{loop $fields_arr_new $v}
						<li class="dd-item dd3-item" data-id="{$v}">
							<div class="dd-handle dd3-handle"></div><div class="dd3-content">
							<label class="css-checkbox">
								<input type="checkbox" {if in_array($v,$custom_field_arr)}checked="checked"{/if} name="field_arr[]" value="{$v}">
								<span>{$fields_arr[$v]}</span>
							</label>
						</div>
						</li>
						{/loop}
					</ol>
				</div>
			</div>
		</form>
	</div>
</script>
<!--自定义end-->

<script id="editpanel" type="text/html">
	<div>
		<form id="editpanel-form" class="form-horizontal">
			<div class="row">&nbsp</div>
			<div class="form-group">
				<label >标题 </label>
				<input  dtype="" class="form-control" maxlength="50" name="data[title]" placeholder="标题" required cname="标题" value="{[title]}" />
			</div>
			<p class="help-block"></p>
			
			<!-- input -->
			<div class="form-group">
				<label >描述 </label>
				<input  dtype="" class="form-control" maxlength="255" name="data[summary]" placeholder="描述" required cname="描述" value="{[summary]}" />
			</div>
			<p class="help-block"></p>
			
			<!-- input -->
			<div class="form-group">
				<label >宽 </label>
				<input  dtype="" class="form-control" maxlength="{maxlength}" name="data[width]" placeholder="宽" required cname="宽" value="{[width]}" />
			</div>
			<p class="help-block"></p>
			
			<!-- input -->
			<div class="form-group">
				<label >高 </label>
				<input  dtype="" class="form-control" maxlength="{maxlength}" name="data[height]" placeholder="高" required cname="高" value="{[height]}" />
			</div>
			<p class="help-block"></p>
			
			<!-- input -->
			<div class="form-group">
				<label >打开方式 </label>
				<input  dtype="" class="form-control" maxlength="{maxlength}" name="data[cate]" placeholder="打开方式" required cname="打开方式" value="{[cate]}" />
			</div>
			<p class="help-block"></p>
			
			<!-- input -->
			<div class="form-group">
				<label >默认显示 </label>
				<input  dtype="" class="form-control" maxlength="{maxlength}" name="data[default_type]" placeholder="默认显示" required cname="默认显示" value="{[default_type]}" />
			</div>
			<p class="help-block"></p>
			
			<!-- input -->
			<div class="form-group">
				<label >默认显示的内容 </label>
				<input  dtype="" class="form-control" maxlength="255" name="data[default_content]" placeholder="默认显示的内容" required cname="默认显示的内容" value="{[default_content]}" />
			</div>
			<p class="help-block"></p>
			
			<!-- input -->
			<div class="form-group">
				<label >打开方式 </label>
				<input  dtype="" class="form-control" maxlength="{maxlength}" name="data[status]" placeholder="打开方式" required cname="打开方式" value="{[status]}" />
			</div>
			<p class="help-block"></p>
		</form>
	</div>
</script>

<!-- pagescript -->
<script type="text/javascript">
	seajs.use("admin/information_ad_placeindex",function (parameter){
		<!--tmpl-templatejavascript-->
		parameter.detailUrl="{$detail_url}";
		parameter.deleteUrl="{$delete_url}";
		parameter.editUrl="{$do_edit_url}";
		parameter.upload_url="{$upload_url}";
		parameter.image_search_url="{$image_search_url}";
		parameter.image_list_url="{$image_list_url}";
		parameter.init();		
	});
</script>


<script id="assocpage" type="text/html">
<div class="text-right">
	<ul class="pagination blog-pagination">
		<li><a class="assoc-page" data-page="{[prev]}" href="javascript:void(0);">上一页</a></li> 
		{[loop pages page]}
		<li {[if curr == page]}class="active"{[/if]}><a class="assoc-page" data-page="{[page]}"  href="javascript:void(0)">{[page]}</a></li> 
		{[/loop]}
		<li><a class="assoc-page" href="javascript:void(0);" data-page="{[nexts]}">下一页</a></li> 
	</ul>	
</div>
</script>
</body>
</html>
